package com.zingrow.web.report.service.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zingrow.common.utils.PageView;
import com.zingrow.web.base.service.impl.BaseService;
import com.zingrow.web.report.mapper.RptEnshrineMapper;
import com.zingrow.web.report.model.RptEnshrine;
import com.zingrow.web.report.response.ModuleData;
import com.zingrow.web.report.service.IRptEnshrineService;

@Service
public class RptEnshrineServiceImpl extends BaseService<ModuleData> implements IRptEnshrineService {
	@Autowired
	private RptEnshrineMapper enshrineMapper;

	@Override
	public void initMapper() {
	}
	
	@Override
	public List<RptEnshrine> selectAll(PageView pageView,Integer userId) {
		Map<String, Object> map = new HashMap<>();
		map.put("paging", pageView);
		map.put("userId", userId);
		List<RptEnshrine> list = enshrineMapper.selectAll(map);
		return list;
	}

	@Override
	public boolean delEnshrine(Integer userId,Integer ropertId) {
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("userId", userId);
		map.put("ropertId", ropertId);
		return enshrineMapper.delEnshrine(map)>0;
	}

	@Override
	public boolean insertEnshrine(RptEnshrine enshrine) {
		enshrine.setEnshrineTime(new Date());
		return enshrineMapper.insertEnshrine(enshrine)>0;
	}

	@Override
	public int queryByrptIduserId(Integer ropertId, Integer userId) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("ropertId", ropertId);
		map.put("userId", userId);
		return enshrineMapper.queryByrptIduserId(map);
	}
}
